origin = 0
#闭包方式解决
def factory(pos):
    def go(step):
        nonlocal pos    #声明不是一个局部变量
        pos += step
        return pos
    return go

if __name__ == '__main__':
    f = factory(origin)
    step = eval(input())
    while step != -1:
        print('result=',f(step))
        step = eval(input())
